﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using ComicIsland.Common.Entities.InterfaceJson;

/**
 * 创建时间：2015/1/17 13:20:10
 * 作者：yong.blackcore
 * Email：itblackhole@outlook.com
 * QQ：50404503
 */
namespace ComicIsland.App.Views.DTSelector
{
    public class BookStoreProgresstypeTemplateSelector : DataTemplateSelector
    {
        /// <summary>
        /// 连接中
        /// </summary>
        public DataTemplate OnlineArea { get; set; }

        /// <summary>
        /// 完结
        /// </summary>
        public DataTemplate EndArea { get; set; }

        /// <summary>
        /// 根据NewsInf的属性，返回对应的DataTemplate 
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="container"></param>
        /// <returns></returns>

        public override DataTemplate SelectTemplate(object obj, DependencyObject container)
        {
            JsonBookStoreAlbumInfoAreaBlock item = obj as JsonBookStoreAlbumInfoAreaBlock;
            if (item != null)
            {
                if (item.Progresstype ==0)
                {
                    return EndArea;
                }
                else
                {
                    return OnlineArea;
                }
            }
            return base.SelectTemplate(item, container);
        }
    }
}
